import { Inject } from '@midwayjs/core';
import { CoolController, BaseController } from '@cool-midway/core';
import { GoodsUserPriceStrategyEntity } from '../../entity/userPriceStrategy';
import { GoodsUserPriceStrategyService } from '../../service/userPriceStrategy';
import { UserInfoEntity } from '../../../user/entity/info';

/**
 * 用户价格策略
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: GoodsUserPriceStrategyEntity,
  service: GoodsUserPriceStrategyService,
  pageQueryOp: {
    fieldEq: ['a.userId', 'a.strategyType', 'a.status'],
    select: ['a.*', 'b.nickName as username'],
    join: [
      {
        entity: UserInfoEntity,
        alias: 'b',
        condition: 'a.userId = b.id',
      },
    ],
  },
})
export class AdminGoodsUserPriceStrategyController extends BaseController {
  @Inject()
  goodsUserPriceStrategyService: GoodsUserPriceStrategyService;
}
